const path = require("path");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    // mode: "development",
    mode: "production",
    //设置入口文件路径
    entry: "./src/index.js",
    //设置出口文件
    output: {
        path: path.join(__dirname, 'dist'),
        //会自动生成一个dist文件夹
        filename: 'rel.js',
    },
    plugins: [
        new HtmlWebpackPlugin({ template: './public/index.html' })
    ],
    module: {
        rules: [
            {
                //test设置需要匹配的文件类型，支持正则
                test: /\.css$/,
                //use表示该文件类型需要调用的loader
                use: ['style-loader', 'css-loader']
            },
            {
                test: /\.less$/,
                use: ['style-loader', 'css-loader', 'less-loader']
            }
        ]
    },
    devServer: {
        port: 9000,
        open: true
    }
}